package solutions.ferpa.ztest.intf;

import br.com.telescope.adsrt.dom.DomDouble;
import br.com.telescope.adsrt.dom.DomId;
import br.com.telescope.t2.ServiceModel;
import br.com.telescope.t2.feature.DeleteFeature;
import br.com.telescope.t2.feature.ListFeature;
import br.com.telescope.t2.feature.MultiRowInsertFeature;
import br.com.telescope.t2.feature.MultiRowUpdateFeature;
import br.com.telescope.t2.feature.QueryFeature;
import br.com.telescope.t2.feature.ViewFeature;
import solutions.ferpa.ztest.ent.*;

/**
 * Vazões e volumes para escoar.
 * <p>
 * Interface para manutenção de Vazão e volume para escoar
 * <P>
 * Telescope origin: ZTEST.CAD_CLASSE_VAZAO_VOLUME
 * <P>
 * Base entity: ZTEST.CLASSE_VAZAO_VOLUME
 * <P>
 * @author TELESCOPE - Build task T2 Web Interface Generator
 * <P>
 * @version 0.1
 */
public class CadClasseVazaoVolume extends ServiceModel {
    
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    public static final String GLOBAL_NAME = "ZTEST.CAD_CLASSE_VAZAO_VOLUME";
    
    @Override
    public String globalName() {
        return GLOBAL_NAME;
    }
    
    {
        setTitle("Vazões e volumes para escoar");
    }
    
    protected EntClasseVazaoVolume base;
    protected EntClasseVazaoVolume rec; // NEED_TJW1_COMPATIBILITY
    
    // Record items
    private DomDouble aVolumeLitrosHora;
    private DomDouble aVolumeEsperadoEscoar;
    private DomId aId;
    
    // Query items
    private DomDouble qVolumeEsperadoEscoar;
    private DomDouble qVolumeLitrosHora;
    
    @Override
    public String getBaseSql() {
        return "select BASE.*"
                + " from CLASSE_VAZAO_VOLUME BASE";
    }
    
    @Override
    public void initAttributes() {
        
        aVolumeLitrosHora = new DomDouble();
        aVolumeLitrosHora.context(ctx).name("VOLUME_LITROS_HORA").label("Vazão esperada em L/h").summary(true);
        
        aVolumeEsperadoEscoar = new DomDouble();
        aVolumeEsperadoEscoar.context(ctx).name("VOLUME_ESPERADO_ESCOAR").label("Massa a escoar em KG").summary(true);
        
        aId = new DomId();
        aId.context(ctx).name("ID").label("Id");
        
        
        qVolumeEsperadoEscoar = new DomDouble();
        qVolumeEsperadoEscoar.context(ctx).name("VOLUME_ESPERADO_ESCOAR").label("Massa a escoar em KG");
        
        qVolumeLitrosHora = new DomDouble();
        qVolumeLitrosHora.context(ctx).name("VOLUME_LITROS_HORA").label("Vazão esperada em L/h");
    }
    
    @Override
    public String getQueryPkColumn() {
        return "BASE.ID";
    }
    
    @Override
    public void setId(String value) {
        this.aId.setValue(value);
    }
    
    @Override
    public EntClasseVazaoVolume getRecord() {
        if (base == null) {
            base = new EntClasseVazaoVolume(ctx);
            rec = base;
        }
        return this.base;
    }
    
    @Override
    public String getContextName() {
        return aVolumeLitrosHora.toText();
    }
    
    @Override
    public String getDefaultOrderBy() {
        return "VOLUME_LITROS_HORA, VOLUME_ESPERADO_ESCOAR";
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="QUERY">
    public class FQuery extends QueryFeature {
        
        @Override
        public void initForm() {
            addField(qVolumeLitrosHora, "opt");
            addField(qVolumeEsperadoEscoar, "opt");
        }
        
        {
            setFeatureName("QUERY");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="LIST">
    public class FList extends ListFeature {
        
        @Override
        public void initForm() {
            addField(aVolumeLitrosHora, "view");
            addField(aVolumeEsperadoEscoar, "view");
        }
        
        {
            setFeatureName("LIST");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="VIEW">
    public class FView extends ViewFeature {
        
        @Override
        public void initForm() {
            addField(aVolumeLitrosHora, "view");
            addField(aVolumeEsperadoEscoar, "view");
        }
        
        {
            setFeatureName("VIEW");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="INSERT">
    public class FInsert extends MultiRowInsertFeature {
        
        @Override
        public void initForm() {
            aVolumeLitrosHora.setOptional(false);
            addField(aVolumeLitrosHora, "rqd");
            aVolumeEsperadoEscoar.setOptional(false);
            addField(aVolumeEsperadoEscoar, "rqd");
        }
        
        {
            setFeatureName("INSERT");
            setPrimary(false);
            setRows(15);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="UPDATE">
    public class FUpdate extends MultiRowUpdateFeature {
        
        @Override
        public void initForm() {
            aVolumeLitrosHora.setOptional(false);
            addField(aVolumeLitrosHora, "rqd");
            aVolumeEsperadoEscoar.setOptional(false);
            addField(aVolumeEsperadoEscoar, "rqd");
        }
        
        {
            setFeatureName("UPDATE");
            setPrimary(false);
            setRows(15);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="DELETE">
    public class FDelete extends DeleteFeature {
        
        @Override
        public void initForm() {
        }
        
        {
            setFeatureName("DELETE");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="initFeatures">
    
    @Override
    protected void initFeatures() {
        addFeature(new FQuery());
        addFeature(new FList());
        addFeature(new FView());
        addFeature(new FInsert());
        addFeature(new FUpdate());
        addFeature(new FDelete());
        super.initFeatures();
    }
    
    @Override
    public String getDefaultFeature() {
        return "QUERY";
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="Getters and Setters">
    
    public Double getVolumeLitrosHora() {
        return aVolumeLitrosHora.getValue();
    }
    
    public void setVolumeLitrosHora(Double value) {
        this.aVolumeLitrosHora.setValue(value);
    }
    
    public Double getVolumeEsperadoEscoar() {
        return aVolumeEsperadoEscoar.getValue();
    }
    
    public void setVolumeEsperadoEscoar(Double value) {
        this.aVolumeEsperadoEscoar.setValue(value);
    }
    
    @Override
    public Long getId() {
        return aId.getValue();
    }
    
    public void setId(Long value) {
        this.aId.setValue(value);
    }
    public String getQueryVolumeLitrosHora() {
        return qVolumeLitrosHora.getQueryValue();
    }
    
    public void setQueryVolumeLitrosHora(String value) {
        this.qVolumeLitrosHora.setQueryValue(value);
    }
    public String getQueryVolumeEsperadoEscoar() {
        return qVolumeEsperadoEscoar.getQueryValue();
    }
    
    public void setQueryVolumeEsperadoEscoar(String value) {
        this.qVolumeEsperadoEscoar.setQueryValue(value);
    }
    // </editor-fold>
    
}
